package com.idea.zd.sys.train.io;

import org.apache.commons.io.input.ReaderInputStream;

import java.io.*;

public class FileInputStreamTest {

    /**
     * 输入字节流
     * @param args
     * @throws IOException
     */
    /*public static void main(String args[]) throws IOException{

        File file = new File(".");
        for(String f:file.list()){
            System.out.println(f);
        }
        //创建字节流
        //FileInputStream fileInputStream = new FileInputStream("./src/main/java/com/idea/zd/sys/train/io/FileInputStreamTest.java");
        FileInputStream fileInputStream = new FileInputStream("ss.fxml");
        //字节数组
        byte[] bbuf = new byte[1024];
        //返回长度
        int hasRead = 0;

        while((hasRead = fileInputStream.read(bbuf))>0){

            System.out.print(new String(bbuf,0,hasRead));
        }

        fileInputStream.close();
    }*/

    /*public static void main(String args[]) throws IOException{

        *//*File file = new File(".");
        for(String f:file.list()){
            System.out.println(f);
        }*//*
        //创建字节流
        //FileInputStream fileInputStream = new FileInputStream("./src/main/java/com/idea/zd/sys/train/io/FileInputStreamTest.java");
        FileInputStream fileInputStream = new FileInputStream("TBusinessDutyLog.java");
        BufferedReader br = new BufferedReader(new InputStreamReader(fileInputStream),60 * 1024 * 1024);
        //返回长度
        int hasRead = 0;
        String Str = "";
        *//*while((hasRead = fileInputStream.read(bbuf))>0){
            String tempStr = new String(bbuf,0,hasRead);
            if(tempStr.contains("private")){
                System.out.println(tempStr.substring(tempStr.lastIndexOf(" "),tempStr.length()-1)+":");
            }
        }*//*

        String lineTxt = null;
        String col="";
        while ((lineTxt = br.readLine()) != null) {

            if(lineTxt.contains("Img")||lineTxt.contains("img")){

            }else{
                if(lineTxt.contains("private")){
                    Str += ("formFile.append(\""+lineTxt.substring(lineTxt.lastIndexOf(" "),lineTxt.length()-1)+"\",").trim()+col;
                }

                if(lineTxt.contains("@Column(name=")){
                    col= "$(\"#"+lineTxt.replace("@Column(name=","").replaceFirst("\"","").trim()+".html());\n";
                }
            }



        }

        System.out.println(Str);
        fileInputStream.close();
    }*/

    public static void main(String args[]) throws IOException{

        String ss ="if(data.before_24_img !=\"\" || data.before_24_img != null){\n" +
                "                    $('#before_24_img').html('<img src=\"'+data.before_24_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"before_24_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.yesterday_flight_line_img !=\"\" || data.yesterday_flight_line_img != null){\n" +
                "                    $('#yesterday_flight_line_img').html('<img src=\"'+data.yesterday_flight_line_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"yesterday_flight_line_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.rain_24h_img !=\"\" || data.rain_24h_img != null){\n" +
                "                    $('#rain_24h_img').html('<img src=\"'+data.rain_24h_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"rain_24h_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.rain_48h_img !=\"\" || data.rain_48h_img != null){\n" +
                "                    $('#rain_48h_img').html('<img src=\"'+data.rain_48h_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"rain_48h_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.rain_72h_img !=\"\" || data.rain_72h_img != null){\n" +
                "                    $('#rain_72h_img').html('<img src=\"'+data.rain_72h_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"rain_72h_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.weather_500hpa_img !=\"\" || data.weather_500hpa_img != null){\n" +
                "                    $('#weather_500hpa_img').html('<img src=\"'+data.weather_500hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"weather_500hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.weather_700hpa_img !=\"\" || data.weather_700hpa_img != null){\n" +
                "                    $('#weather_700hpa_img').html('<img src=\"'+data.weather_700hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"weather_700hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.weather_850hpa_img !=\"\" || data.weather_850hpa_img != null){\n" +
                "                    $('#weather_850hpa_img').html('<img src=\"'+data.weather_850hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"weather_850hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.land_img !=\"\" || data.land_img != null){\n" +
                "                    $('#land_img').html('<img src=\"'+data.land_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"land_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.ec_500hpa_img !=\"\" || data.ec_500hpa_img != null){\n" +
                "                    $('#ec_500hpa_img').html('<img src=\"'+data.ec_500hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"ec_500hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.ec_700hpa_img !=\"\" || data.ec_700hpa_img != null){\n" +
                "                    $('#ec_700hpa_img').html('<img src=\"'+data.ec_700hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"ec_700hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.ec_850hpa_img !=\"\" || data.ec_850hpa_img != null){\n" +
                "                    $('#ec_850hpa_img').html('<img src=\"'+data.ec_850hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"ec_850hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.ec_land_img !=\"\" || data.ec_land_img != null){\n" +
                "                    $('#ec_land_img').html('<img src=\"'+data.ec_land_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"ec_land_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.today_flight_job_img !=\"\" && data.today_flight_job_img != null && data.today_flight_job_img != undefined){\n" +
                "                    $('#today_flight_job_img').html('<img src=\"'+data.today_flight_job_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"today_flight_job_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.today_500hpa_img !=\"\" || data.today_500hpa_img != null){\n" +
                "                    $('#today_500hpa_img').html('<img src=\"'+data.today_500hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"today_500hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.today_700hpa_img !=\"\" || data.today_700hpa_img != null){\n" +
                "                    $('#today_700hpa_img').html('<img src=\"'+data.today_700hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"today_700hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.today_850hpa_img !=\"\" || data.today_850hpa_img != null){\n" +
                "                    $('#today_850hpa_img').html('<img src=\"'+data.today_850hpa_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"today_850hpa_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.today_land_img !=\"\" || data.today_land_img != null){\n" +
                "                    $('#today_land_img').html('<img src=\"'+data.today_land_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"today_land_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.red_cloud_img !=\"\" || data.red_cloud_img != null){\n" +
                "                    $('#red_cloud_img').html('<img src=\"'+data.red_cloud_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"red_cloud_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.radar_img !=\"\" || data.radar_img != null){\n" +
                "                    $('#radar_img').html('<img src=\"'+data.radar_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"radar_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.before_6h_rain_img !=\"\" || data.before_6h_rain_img != null){\n" +
                "                    $('#before_6h_rain_img').html('<img src=\"'+data.before_6h_rain_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"before_6h_rain_img\",width: 100, height: 100});\n" +
                "                }\n" +
                "                if(data.before_12h_rain_img !=\"\" || data.before_12h_rain_img != null){\n" +
                "                    $('#before_12h_rain_img').html('<img src=\"'+data.before_12h_rain_img+'\" >');\n" +
                "\n" +
                "                }else{\n" +
                "                    ckImgPreview({id: \"before_12h_rain_img\",width: 100, height: 100});\n" +
                "                }";


        ss = ss.replace("||","&&");
        ss = ss.replace("null","null && data.{} != undefined");
        System.out.println(ss);


    }

}
